package com.lks.common.util;

import java.util.Random;

import org.springframework.stereotype.Component;

@Component("regexUtil")
public class RegexUtil
{
	public String randStr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

	/**
	 * 生成随机字符串
	 * 
	 * @param len
	 * @return
	 */
	public String randString(int len)
	{

		StringBuffer sb = new StringBuffer();
		Random random = new Random();

		for (int i = 0; i < len; i++)
		{
			int randCh = random.nextInt(this.randStr.length());
			sb.append(this.randStr.charAt(randCh));
		}
		return sb.toString();
	}
}
